using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Slobby.Client.UI {
    public partial class frmMain : Form {
        public frmMain() {
            InitializeComponent();
            topBar.HostClicked += new EventHandler(topBar_HostClicked);
        }

        public event EventHandler HostClicked;
        void topBar_HostClicked(object sender, EventArgs e) {
            HostClicked(this, e);
        }

        private Control currentView;

        public void ChangeView(Control newView) {
            SuspendLayout();
            if (currentView != null) {
                currentViewContainer.Controls.Remove(currentView);
            }

            currentViewContainer.Controls.Add(newView);
            newView.Dock = DockStyle.Fill;

            currentView = newView;
            
            ResumeLayout(true);

            FocusView();
        }

        public void FocusView() {
            currentView.Focus();
        }

        public bool LoggedIn {
            set {
                topBar.ShowLoggedInControls = value;
            }
        }
    }
}